/***************************************************************************
   Startup.c - standard startup code
   The startup code may be optimized to special user requests

Note: ROM libraries are not implemented in this startup code
***************************************************************************/

#include "hidef.h"
#include "sys_startup.h"
 
void App(void);

#pragma DATA_SEG __NEAR_SEG STARTUP_DATA //_startupData can be accessed using 16 BOOL accesses.

struct _tagStartup _startupData; // read-only: _startupData is allocated in ROM
                                 // and initialized by the linker 

#pragma DATA_SEG DEFAULT



//#include "non_bank.sgm"

/* The function _Startup must be called in order to initialize global variables and to call main */
/* You can adapt this function or call it from your startup code to implement a different startup */
/* functionality. */

/* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */
/* on hardware */

/* to set the reset vector several ways are possible : */
/* 1. define the function with "interrupt 0" as done below in the first case */
/* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */
/* of course, even more posibilities exists */
/* the reset vector must be set so that the application has a defined entry point */

#pragma CODE_SEG __NEAR_SEG NON_BANKED 

void _Startup(void) {
/*  purpose:    1)  initialize the stack
                2)  initialize the RAM, copy down init data etc (Init)
                3)  call main;
    parameters: NONE
    called from: _PRESTART-code generated by the Linker
                 or directly referenced by the reset vector */

// initialize the stack pointer 
//   INIT_SP_FROM_STARTUP_DESC(); 

//   Init();  // zero out, copy down, call constructors 
   
   App();  // RQ, define in SYS_STARTUP.C
}

#pragma CODE_SEG DEFAULT
